const { getUserData } = require('../../../../../model/user');

Component({
  properties: {
    address: {
      type: Object,
      value: null, // 默认无地址
    },
  },
  methods: {
    onCardTap() {
      const user = getUserData(); // 获取用户信息
      if (user.info && user.info.id) {
        // 跳转到地址列表界面并传递 userId
        wx.navigateTo({
          url: `/pages/usercenter/address/list/index?userId=${user.info.id}`,
        });
      } else {
        wx.showToast({
          title: '用户未登录',
          icon: 'none',
        });
      }
    },
  },
});
